import http from '@/server'

/** 所有角色列表 */
export async function getAllRoleList(data: Role.RoleEntity) {
    return http.request({
      url: '/role/search',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
  }

/** 获取可用角色列表 */
export async function getRoleList() {
  return http.request({
    url: '/role/searchAllRole',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data: {},
  })
}

/** 编辑角色 */
export async function editRole(data: Role.RoleEntity) {
    return http.request({
        url: '/role/update',
        method: 'post',
        headers: {
            'Content-Type': 'application/json', 
        },
        data
    })
}

/** 添加角色 */
export async function addRole(data: Role.RoleEntity) {
  return http.request({
    url: '/role/add',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}

/** 禁用/解禁角色 */
export async function switchForbidden(data: Role.RoleEntity) {
  return http.request({
    url: '/role/disable',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}

/** 删除角色 */
export async function deleteRole(data: Role.RoleEntity) {
  return http.request({
    url: '/role/del',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}

/** 角色新增授权 */
export async function permitRole(data: Role.RoleEntity) {
  return http.request({
    url: '/role_menu/add',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}

/** 修改角色授权 */
export async function editUserRole(data: Role.RoleEntity) {
  return http.request({
    url: '/role_menu/update',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}


/** 分页查询 */
export async function getIpList(data: any) {
  return http.request({
    url: '/ip/search',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}
/** 信息查询 */
export async function getIpInfo(data: any) {
  return http.request({
    url: '/ip/info',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}
/** 修改 */
export async function updateIpInfo(data: any) {
  return http.request({
    url: '/ip/update',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}
/** 修改 */
export async function delIp(data: any) {
  return http.request({
    url: '/ip/del',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}
/** 新增 */
export async function addip(data: any) {
  return http.request({
    url: '/ip/add',
    method: 'post',
    headers: {
        'Content-Type': 'application/json', 
    },
    data
  })
}